import request from '@/utils/request'

/**
 * 查询
 * @param {Object} params
 */
export function dataApi(params) {
  return request({
    url: '/product/data',
    method: 'get',
    params
  })
}

/**
 * 新增
 * @param {Object} data
 */
export function addApi(data) {
  return request({
    url: '/product',
    method: 'post',
    data
  })
}

/**
 * 修改
 * @param {Object} data
 */
export function editApi(data) {
  return request({
    url: '/product',
    method: 'put',
    data
  })
}

/** 根据主键查询
 * @param {Object} id
 */
export function findByIdApi(id) {
  return request({
    url: '/product/' + id,
    method: 'get'
  })
}

/**
 * 上下架操作API
 * @param {Object} ids
 */
export function upOrDownApi(ids, status) {
  return request({
    url: '/product/isgrounding?status=' + status + '&ids=' + ids,
    method: 'GET'
  })
}

/**
 * 读取口味列表API
 */
export function dishFlavorApi(){
  return request({
      url:  '/product/dishflavor',
      method: 'GET'
    })
}
